package com.aya;

import com.aya.compsite.CompositeSayhi;
import com.aya.nested.model.ABean;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringAnalysis {

    @Test
    public void testNestedBean() {
        ApplicationContext factory = new ClassPathXmlApplicationContext("applicationContext.xml");

        ABean bean = factory.getBean("aBean", ABean.class);
        ((ClassPathXmlApplicationContext) factory).close();

    }

    @Test
    public void testCompositeBean() {
        ApplicationContext factory = new ClassPathXmlApplicationContext("applicationContext.xml");

        CompositeSayhi bean = factory.getBean(CompositeSayhi.class);
        bean.sayHi("pollo");
        ((ClassPathXmlApplicationContext) factory).close();

    }

}
